/*
 * @Author: 熊志伟 xiongzhiwei
 * @Date: 2024-11-08 13:34:26
 * @LastEditors: 熊志伟 xiongzhiwei
 * @LastEditTime: 2024-11-12 17:07:19
 * @FilePath: \sr_system_manager_ui\vite\plugins\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import vue from '@vitejs/plugin-vue'

import createAutoImport from './auto-import'
import createSvgIcon from './svg-icon'
import createCompression from './compression'
import createSetupExtend from './setup-extend'
import UnoCSS from 'unocss/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

export default function createVitePlugins(viteEnv, isBuild = false) {
    const vitePlugins = [vue()]
    vitePlugins.push(createAutoImport())
	  vitePlugins.push(createSetupExtend())
    vitePlugins.push(createSvgIcon(isBuild))
    vitePlugins.push(UnoCSS())
    vitePlugins.push(Components({
      dirs: ['src/components'],
      extensions: ['vue'],
      dts: 'components.d.ts',
      resolvers: [
        ElementPlusResolver()
      ],
    }))
	  isBuild && vitePlugins.push(...createCompression(viteEnv))
    return vitePlugins
}
